
function isMacAddressValid(id){
	var i = $('#' + id);
	//alert(i.attr("value"));
	if(i.attr("value")=="")return true;
	var reMac = /^([0-9a-f]){12}$/i
	if(i.attr("value").search(reMac)==-1)
		return false;
	return true;
}

function checkMacAddress(){
	var form = $('#component_form');
	var result = false;
	form.bind("submit", function(e){
	 	if(isMacAddressValid("id_mac_address")){
			status = true;
			if(isMacAddressValid("id_mac_address2")){
                        	status = true;
                	} else {
                        	alert("Check Mac 2 address please 12 char a-f 0-9");
                        	status = false;
                	}
		} else {
			alert("Check Mac 1 address please 12 char a-f 0-9");
			status = false;
		}
		
	    return status;
	});

}

$(document).ready(
function() { 
	checkMacAddress();
}
);

